#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int distanceTraveled(int mainTank, int additionalTank) {
    int ans = 0;
    int res = 0;
    int count = 0;
    if (mainTank < 5)
        return mainTank * 10;
    else
    {
        ans = mainTank;
        count = additionalTank;
        while (ans >= 5 && count >= 1)
        {
            ans = ans - 5 + 1;
            res++;
            count--;
        }
    }
    return res * 10 + mainTank * 10;
}

int main()
{

	return 0;
}